<?php if (!defined('THINK_PATH')) exit(); /*a:1:{s:80:"/data/mnt/wwwroot/luckydraw/m/public/../application/view/prize/treasureChest.php";i:1497334883;}*/ ?>
<!DOCTYPE HTML>
<html>
<head>
    <meta charset="utf-8">
    <meta name="format-detection" content="telephone=no" />
    <meta name="viewport" content="width=device-width,initial-scale=1.0,user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes" />
    <meta name="apple-mobile-web-app-status-bar-style" content="black" />
    <link rel="stylesheet" href="<?php echo \think\Config::get('resources'); ?>/treasureChest/css/reset.css">
    <link rel="stylesheet" href="<?php echo \think\Config::get('resources'); ?>/treasureChest/css/atom.css">
    <link rel="stylesheet" href="<?php echo \think\Config::get('resources'); ?>/treasureChest/css/global.css">
    <link rel="stylesheet" href="<?php echo \think\Config::get('resources'); ?>/treasureChest/css/open.css">
    <title>礼包</title>
</head>
<body ontouchstart="" class="open-body">
<div class="wrapper">

    <div class="bg rotate"></div>
    <div class="open-has " >
        <h3 class="title-close"></h3>
        <h3 class="title-open">恭喜你，</br>成功领取<span class="user">联票网</span>发的抽奖礼包</h3>
        <div class="mod-chest">
            <div class="chest-close show ">
                <div class="gift"></div>
                <div class="tips">
                    <i class="arrow"></i>
                </div>
            </div>
            <div class="chest-open ">
                <div class="mod-chest-cont open-cont">
                    <div class="content">
                        <div class="gift">
                            <div id="success_message" class="icon"></div>
                        </div>
                        <div class="func">
                            <button class="chest-btn" onclick="window.location.href='<?php echo $url; ?>'">查看奖品</button>
                        </div>
                    </div>
                </div>
            </div>

        </div>
    </div>
    <div class="open-none" style="display:none">
        <h3 id="error_message">你来晚啦，下次早点吧！</h3>
        <div class="mod-chest">
            <div class="chest-open show"></div>
        </div>
        <div class="func">
            <button class="chest-btn" onclick="window.location.href='<?php echo $url; ?>'">返回</button>
        </div>
    </div>
</div>
<script type="text/javascript" src="<?php echo \think\Config::get('resources'); ?>/treasureChest/js/zepto.min.js"></script>
<script type="text/javascript">
    $(".chest-close").click(function(){
        $(this).addClass("shake");
        var that=this;
        var url="<?php echo url('prize'); ?>";
        var datastr="lpn="+<?php echo $lpn; ?>;
        $.ajax({
            url: url,
            data: datastr,
            type: "POST",
            dataType: "json",
            success: function(data) {
                if (data.status) {
                    $("#success_message").text(data.message);
                    this.addEventListener("webkitAnimationEnd", function(){
                        $(that).closest(".open-has").addClass("opened");
                        setTimeout(function(){
                            $(that).removeClass("show");
                            $(that).closest(".mod-chest").find(".chest-open").addClass("show");
                            setTimeout(function(){
                                $(".chest-open").addClass("blur");
                            },500)
                        },200)
                    }, false);
                }else{
                    $(".open-has").css('display','none');
                    $(".open-none").css('display','block');
                    $("#error_message").text(data.message);
                }
            },
            error:function(XMLHttpRequest, textStatus, errorThrown){
                alert('抽奖失败,请重试');
            }
        });
    })
</script>
<div style="text-align:left;font:normal 14px/24px 'MicroSoft YaHei'; color:#865500; width:80%; margin:28px auto; ">
    <p>
        <?php echo $use_content; ?>
    </p>
</div>
</body>
</html>